<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>


<button class="click">click</button>


<script>
    document.querySelector('.click').onclick = function() {
        alert(123);
    }
</script>

</body>
</html>